<?php
include 'connect.php';
$sql = "select * from reserve where 1=1";
$con=isset($_GET['con'])?$_GET['con']:'';
$content=isset($_GET['content'])?$_GET['content']:'';

if ($content=='sousuo'){
    $sql.=" and title like '%$con%' or price like '%$con%' or address like '%$con%' or username like '%$con%'";
    //$sql.=" and title like '%$con%' or content like '%$con%'";
}
$restle = mysqli_query($link,$sql);
$messages=[];


while ($row=mysqli_fetch_assoc($restle)){
    $messages[$row['id']]['id']=$row['id'];
    $messages[$row['id']]['username']=$row['username'];
    $messages[$row['id']]['title']=$row['title'];
    $messages[$row['id']]['price']=$row['price'];
    $messages[$row['id']]['jiegou']=$row['jiegou'];
    $messages[$row['id']]['mianji']=$row['mianji'];
    $messages[$row['id']]['louceng']=$row['louceng'];
    $messages[$row['id']]['address']=$row['address'];
    $messages[$row['id']]['fdname']=$row['fdname'];
    $messages[$row['id']]['img']=$row['img'];
    $messages[$row['id']]['state']=$row['state'];
}
echo json_encode($messages);
